Skip to content

uefi-raw: hii: Add Database Protocol #1510

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 7, 2025

Conversation

crawfxrd
Copy link
Contributor

@crawfxrd crawfxrd commented Jan 4, 2025

Begin implementation of HII, starting with the DB protocol.

The DB protocol itself is not particularly useful for most users. But is brings up several important questions for a Rust interface of some core HII types:

  • UEFI EFI_HII_HANDLE (void *) is not defined here; I am just using Handle. Should it be re-defined or re-exported?
  • UEFI EFI_KEY doesn't explicitly define values; this does. This seems necessary for a C interface. Should it be kept?
  • Key modifiers are grouped as a type; UEFI uses top-level defines with the suffix _MODIFIER. Should it exactly match UEFI?

Ref: UEFI 2.11: 34.8 Database Protocol

Checklist

  • Sensible git history (for example, squash "typo" or "fix" commits). See the Rewriting History guide for help.
  • Update the changelog (if necessary)

@nicholasbishop
Copy link
Member

nicholasbishop commented Jan 6, 2025

UEFI EFI_HII_HANDLE (void *) is not defined here; I am just using Handle. Should it be re-defined or re-exported?

I think a new type alias would be good to add, pub type HiiHandle = *mut c_void

UEFI EFI_KEY doesn't explicitly define values; this does. This seems necessary for a C interface. Should it be kept?

Just to make sure I understand correctly, you are saying that the C version relies on implicit enum member numbering (first entry 0, second 1, etc), while the Rust version has explicit = 0, = 1, etc? That's fine I think, we need to be more explicit in Rust. I would remove the "// NOTE: UEFI does not define the values for any keys" comment; UEFI is implicitly defining the numeric values by specifying the values in terms of a C enum, which has defined rules.

Key modifiers are grouped as a type; UEFI uses top-level defines with the suffix _MODIFIER. Should it exactly match UEFI?

I think the newtype_enum you've added for modifiers is good.

Ref: UEFI 2.11: 34.8 Database Protocol
Signed-off-by: Tim Crawford <[email protected]>
@nicholasbishop nicholasbishop added this pull request to the merge queue Jan 7, 2025
Merged via the queue into rust-osdev:main with commit 3f819f4 Jan 7, 2025
15 checks passed
@crawfxrd crawfxrd deleted the hii-db branch January 10, 2025 04:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants